Python Forum
Use range to add char. to empty string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use range to add char. to empty string
#2
lett = ' ' # This is not an empty string! There is space between quotes.
for _ in range(7):
     append.lett(b) #  You can use `+=`, e.g. lett += 'b'
print(lett)
Reply


Messages In This Thread
RE: Use range to add char. to empty string - by scidam - Apr-15-2019, 10:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with stripping special char and spaces mumstead 7 2,890 Jun-11-2020, 05:44 AM
Last Post: Yoriz
  String index out of range felie04 2 5,638 Aug-17-2018, 11:18 PM
Last Post: felie04
  string index out of range cusick11 9 15,351 Mar-03-2017, 11:45 PM
Last Post: ichabod801
  Invalid syntax: string index out of range darkreaper1959 6 6,294 Jan-22-2017, 06:24 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