Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53454
| X-Received | by 10.224.137.68 with SMTP id v4mr23828328qat.1.1378095643704; Sun, 01 Sep 2013 21:20:43 -0700 (PDT) |
|---|---|
| X-Received | by 10.49.99.37 with SMTP id en5mr10078qeb.8.1378095643687; Sun, 01 Sep 2013 21:20:43 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!q10no2453557qai.0!news-out.google.com!p7ni345qas.0!nntp.google.com!j7no65648qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Sun, 1 Sep 2013 21:20:43 -0700 (PDT) |
| In-Reply-To | <mailman.466.1378081991.19984.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=190.252.41.120; posting-account=V9lbLwoAAADhHgR3H3DfW0v3fCjN9Bwb |
| NNTP-Posting-Host | 190.252.41.120 |
| References | <c795fae4-2b38-4d81-a552-a69febdac0c0@googlegroups.com> <mailman.466.1378081991.19984.python-list@python.org> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <b70a6f24-c38f-45ad-bdb2-b9c5458ce150@googlegroups.com> (permalink) |
| Subject | Re: How to split with "\" character, and licence copyleft mirror of © |
| From | materile11@gmail.com |
| Injection-Date | Mon, 02 Sep 2013 04:20:43 +0000 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.python:53454 |
Show key headers only | View raw
El domingo, 1 de septiembre de 2013 19:34:16 UTC-5, Tim Chase escribió:
> 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
Thank you, I've used the os.path.basename to solve my problem.
Regards.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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