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

Cameron Simpson cs at zip.com.au
Sun Sep 1 20:23:41 EDT 2013


On 01Sep2013 17:03, materile11 at gmail.com <materile11 at gmail.com> wrote:
| <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'.

Firstly, you want to say '\\' for a slosh (just as you would say '\n' for a linefeed).

However, you really should use the os.path module, in particular os.path.split().

Have a read of:
  http://docs.python.org/3/library/os.path.html#module-os.path
  http://docs.python.org/2/library/os.path.html#module-os.path

| I also want to know how to mirror a character, in my case this
| one ©, because I'll use the Copyleft http://en.wikipedia.org/wiki/Copyleft
| to distribute my app.

Isn't that a copyright symbol? I'd have a look at the "uncidoedata" module,
myself.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

Just because Unix is a multiuser system doesn't mean I want to share it with
anybody!        - Paul Tomblin, in rec.aviation.military



More information about the Python-list mailing list