Python Forum
I want to simplify this python code into fewer lines, it's about string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to simplify this python code into fewer lines, it's about string
#5
Use the str method join as stated in my post above.
c = ['a', 'b', 'a', 'b', 'a', 'b', 'a', 'b']
c = "".join(c)
print(c)
Output:
abababab
mandaxyz likes this post
Reply


Messages In This Thread
RE: I want to simplify this python code into fewer lines, it's about string - by Yoriz - Jan-15-2022, 01:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What are these python lines for? What are tey doing? Led_Zeppelin 7 3,002 Feb-13-2023, 03:08 PM
Last Post: deanhystad
  Regular Expression search to comment lines of code Gman2233 5 2,803 Sep-08-2022, 06:57 AM
Last Post: ndc85430
  Changing a string value to a numerical value using python code and a lamda function Led_Zeppelin 6 2,830 Jul-05-2022, 11:29 PM
Last Post: deanhystad
  Editing text between two string from different lines Paqqno 1 1,830 Apr-06-2022, 10:34 PM
Last Post: BashBedlam
Question [SOLVED] Delete specific characters from string lines EnfantNicolas 4 3,247 Oct-21-2021, 11:28 AM
Last Post: EnfantNicolas
Thumbs Up [SOLVED] Simplify condition test in if block? Winfried 2 2,364 Aug-25-2021, 09:42 PM
Last Post: Winfried
  python seems to be skipping lines of code alansandbucket 1 5,854 Jun-22-2021, 01:18 AM
Last Post: Larz60+
  reading lines from a string [Solved] ebolisa 14 9,752 Mar-28-2021, 08:16 PM
Last Post: perfringo
  Running a few lines of code as soon as my timer ends nethatar 3 3,256 Feb-26-2021, 01:02 PM
Last Post: jefsummers
  Assistance with running a few lines of code at an EXACT time nethatar 5 4,734 Feb-24-2021, 10:43 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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