#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    21
    Rep Power
    0

    How can I sort two stringtext list!


    Hi folks,

    I have two stringtext lists for example:
    Code:
    L1:                L2:
    
    LastName       Lastname
    Firstname       Firstname
    Number          Number
    ID                 ID
    Position          Position
    Now, if I delete one strigtext"Firstname" in L2 list then my list positions changed like this:
    Code:
    L1:                L2:
    
    LastName       Lastname
    Firstname       Number
    Number          ID
    ID                 Position
    Position         Price
    My aim is to have a list like this:

    Code:
    L1:                L2:
    
    LastName       Lastname
    Firstname       None
    Number          Number
    ID                 ID
    Position          Position

    How can I do it like this? Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    /dev/null
    Posts
    164
    Rep Power
    19
    You would already know the index at which 'FirstName' is. So just assign None at that index.
    Code:
    >>> L2 = ['LastName', 'FirstName', 'Number', 'ID', 'Position']
    >>> L2[2] = None
    >>> L2
    ['LastName', 'FirstName', None, 'ID', 'Position']

IMN logo majestic logo threadwatch logo seochat tools logo