Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53443

Re: How to split with "\" character, and licence copyleft mirror of ©

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'string': 0.09; 'character,': 0.09; 'escape': 0.09; 'literal': 0.09; 'way:': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'windows': 0.15; '-tkc': 0.16; 'copyleft': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'subject:mirror': 0.16; 'syntaxerror:': 0.16; 'visual,': 0.16; 'wrote:': 0.18; 'app': 0.19; 'trying': 0.19; 'file,': 0.19; "python's": 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'specify': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'this:': 0.26; 'developing': 0.27; 'header:In-Reply-To:1': 0.27; 'character': 0.29; "doesn't": 0.30; 'characters': 0.30; 'said,': 0.30; "i'm": 0.30; 'mirror': 0.31; 'purely': 0.31; 'run': 0.32; 'subject:with': 0.35; "can't": 0.35; 'display': 0.35; 'knows': 0.35; '(2)': 0.35; 'but': 0.35; 'really': 0.36; 'done': 0.36; "i'll": 0.36; 'should': 0.36; 'two': 0.37; 'question,': 0.38; 'that,': 0.38; 'expect': 0.39; 'does': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'everybody': 0.60; 'email addr:gmail.com': 0.63; 'show': 0.63; 'name': 0.63; 'to:addr:gmail.com': 0.65; 'combining': 0.68; 'subjectcharset:utf-8': 0.72; 'you:': 0.81; '*and*': 0.84; 'received:50.22': 0.84
Date Sun, 1 Sep 2013 19:34:16 -0500
From Tim Chase <python.list@tim.thechases.com>
To materile11@gmail.com
Subject Re: How to split with "\" character, and licence copyleft mirror of ©
In-Reply-To <c795fae4-2b38-4d81-a552-a69febdac0c0@googlegroups.com>
References <c795fae4-2b38-4d81-a552-a69febdac0c0@googlegroups.com>
X-Mailer Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Get-Message-Sender-Via boston.accountservergroup.com: none
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.466.1378081991.19984.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1378081991 news.xs4all.nl 15966 [2001:888:2000:d::a6]:45319
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53443

Show key headers only | View raw


On 2013-09-01 17:03, materile11@gmail.com wrote:
> Hello everybody
> I'm trying to run this: 
> 
> <code>
> >>> a = 'E:\Dropbox\jjfsdjjsdklfj\sdfjksdfkjslkj\flute.wav'
> >>> a.split('\')
> 
> SyntaxError: EOL while scanning string literal
> </code>
> 
> I think that the character '\' is the problem, but unfortunately
> I'm developing a small app for windows and I need to show only the
> name of the .wav file, in this case 'flute.wav'.

To directly answer your question, you need to escape the "\" so it's

  a.split('\\')

That said, it's far better to use Python's built-ins to do the
processing for you:

  >>> import os
  >>> print os.path.basename(a)
  flute.wav

which does what you want *and* works cross-platform:

  [on Linux]
  >>> a = '/home/tkc/path/to/flute.wav'
  >>> print os.path.basename(a)
  flute.wav

> I also want to know how to mirror a character, in my case this one
> ©, because I'll use the Copyleft

This can't be done in much of a general way:  Unicode doesn't specify
this character, and the URL you provided suggests combining two
Unicode characters to get ↄ⃝  Unfortunately, (1) it requires a
display that knows how to produce that, which many terminals can't;
and (2) it's purely visual, not semantic.  If that's what you really
want, you should be able to use:

  copyleft_symbol = u"\u2184\u20DD"

Just be aware that it may not always display the way you expect it to.

-tkc


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to split with "\" character, and licence copyleft mirror of © materile11@gmail.com - 2013-09-01 17:03 -0700
  Re: How to split with "\" character, and licence copyleft mirror of © Cameron Simpson <cs@zip.com.au> - 2013-09-02 10:23 +1000
  Re: How to split with "\" character, and licence copyleft mirror of © Tim Chase <python.list@tim.thechases.com> - 2013-09-01 19:34 -0500
    Re: How to split with "\" character, and licence copyleft mirror of © materile11@gmail.com - 2013-09-01 21:20 -0700
  Re: How to split with "\" character, and licence copyleft mirror of © Tim Chase <python.list@tim.thechases.com> - 2013-09-01 19:40 -0500
  Re: How to split with "\" character, and licence copyleft mirror of © Tim Roberts <timr@probo.com> - 2013-09-01 19:40 -0700
    Re: How to split with "\" character, and licence copyleft mirror of © Ethan Furman <ethan@stoneleaf.us> - 2013-09-02 13:22 -0700
      Re: How to split with "\" character, and licence copyleft mirror of © Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-03 02:06 +0000
        Re: How to split with "\" character, and licence copyleft mirror of © Tim Chase <python.list@tim.thechases.com> - 2013-09-03 05:31 -0500
        Re: How to split with "\" character, and licence copyleft mirror of © random832@fastmail.us - 2013-09-03 14:31 -0400
          Re: How to split with "\" character, and licence copyleft mirror of © Tim Roberts <timr@probo.com> - 2013-09-05 20:33 -0700
            Re: How to split with "\" character, and licence copyleft mirror of � Terry Reedy <tjreedy@udel.edu> - 2013-09-06 02:15 -0400
            Re: How to split with "\" character, and licence copyleft mirror of © random832@fastmail.us - 2013-09-06 09:29 -0400
            Re: How to split with "\" character, and licence copyleft mirror of � Fábio Santos <fabiosantosart@gmail.com> - 2013-09-11 11:16 +0100

csiph-web