On Sep 18, 1:42 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > On Sep 18, 1:31 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > > On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > If I have a file name: AVC1030708.14. How do I strip out certain > > > > characters from the file name? I am so used to using MID, LEFT, and > > > > RIGHT functions, that I have no idea how to do this in python? I have > > > > had trouble as well with most newbies on finding the help. But I have > > > > used the command line built in help, but with no luck. Thanks. > > > > > Kou > > > > Do you want to strip out specific characters, characters in specific > > > positions, or characters matching certain patterns? > > > Yes, I want specific characters in specific positions. > > Try this: > > newString = oldString[0:3] + oldString[5:10] > > Some other quick examples: > > >>> test = "this is a test" > >>> test > 'this is a test' > >>> fred = test[:3] + test[9:] > >>> fred > 'thi test' > >>> test[0:5] > 'this ' > >>> test[:5] > 'this ' > >>> test[4:] > > ' is a test'- Hide quoted text - > > - Show quoted text -
I see. It's so hard to imagine the world of python than from VB. It's like looking at VB is in 2 dimensions, where with Python, it's more 3D. The code is so simple, yet it's hard for me to envision how to do something so simple. I guess it's because the rules or the way of looking at things in Python, things can be stripped down to the bare bones and in so many ways. Thanks. Kou -- http://mail.python.org/mailman/listinfo/python-list