Python Forum
Help with extracting characters from string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with extracting characters from string
#3
Well, DeaD_EyE does it cooler!

Interesting however!

# shortcut to the first 2 places
result = [s[0], s[1]]
diff = 1
for l in range(2, len(s)):
    diff +=l
    if len(s) < diff:
        break
    result.append(s[diff])
    restring = ''.join(result)
    print(restring)
DeaD_EyE likes this post
Reply


Messages In This Thread
RE: Help with extracting characters from string - by Pedroski55 - Feb-19-2024, 01:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Replacing a few characters of a specified character but not all of them from a string fatherted99 7 3,311 Aug-13-2020, 09:08 AM
Last Post: fatherted99
  Counting the number of occurrences of characters in a string nsadams87xx 1 1,963 Jun-16-2020, 07:22 PM
Last Post: bowlofred
  testing indivudual string for alternating characters Titus444 3 2,755 Nov-01-2018, 10:28 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

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