1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Python file modification

Discussion in 'Software Development' started by tsunam, Jul 14, 2005.

Thread Status:
Not open for further replies.
  1. tsunam

    tsunam Thread Starter

    Joined:
    Sep 14, 2003
    Messages:
    1,240
    Alright in a file I have:

    media-sound/beep-media-player 124
    media-video/mplayer 678
    www-client/mozilla-firefox 11278

    Which when read creates a list that reads as such

    ['media-sound/beep-media-player 124\n', 'media-video/mplayer 678\n', 'www-client/mozilla-firefox 11236\n']

    I'm wondering how I can match a since entry in the list so that I can replace it.
     
  2. tsunam

    tsunam Thread Starter

    Joined:
    Sep 14, 2003
    Messages:
    1,240
    I think I'l be able to do it with a index search based on a previously known value

    something like:
    section = clear.index('%s' % (data))

    I should then be able to pop that record out and then add it back in at the end.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/381045

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice