Python Forum
Select single letters from string based on separate string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select single letters from string based on separate string
#1
I've done this in Excel using the =Lookup({}) function, but have no clue how to in Python. String 1 (12 digits): 085236752048. String 2 (10 letters): @ABCDEFGHI. I need to select 5 letters from string 2, based on the values of string 1 from the 7th-11th digit. In this case the result would be; GEB@D. I've tried slice(), but found that I can't index a slice. Thanks for any help. (this is not critical.)
Reply


Messages In This Thread
Select single letters from string based on separate string - by Jpen10 - Dec-10-2019, 03:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  remove gilberishs from a "string" kucingkembar 2 202 Mar-15-2024, 08:51 AM
Last Post: kucingkembar
  Matching string from a file tester_V 5 343 Mar-05-2024, 05:46 AM
Last Post: Danishhafeez
  Python3 string slicing Luchano55 4 534 Feb-17-2024, 09:40 AM
Last Post: Pedroski55
  Copy Paste excel files based on the first letters of the file name Viento 2 348 Feb-07-2024, 12:24 PM
Last Post: Viento
  Retrieve word from string knob 4 432 Jan-22-2024, 06:40 PM
Last Post: Pedroski55
  Writing a Linear Search algorithm - malformed string representation Drone4four 10 833 Jan-10-2024, 08:39 AM
Last Post: gulshan212
  Virtual Env changing mysql connection string in python Fredesetes 0 324 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  Comparing Dataframe to String? RockBlok 2 363 Nov-24-2023, 04:55 PM
Last Post: RockBlok
  Sample random, unique string pairs from a list without repetitions walterwhite 1 401 Nov-19-2023, 10:07 PM
Last Post: deanhystad
  extract substring from a string before a word !! evilcode1 3 491 Nov-08-2023, 12:18 AM
Last Post: evilcode1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020