Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ascii question
#10
If you are not worried about the numbers being first you could use, the slice is trimming of the whitespace characters tab, linefeed, return, formfeed, and vertical tab.
import string

print(string.printable[:-5])
Output:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
Edit: changed the slice to 5 so it includes a space on the end
Reply


Messages In This Thread
ascii question - by DPaul - Aug-20-2021, 09:07 AM
RE: ascii question - by Gribouillis - Aug-20-2021, 09:27 AM
RE: ascii question - by snippsat - Aug-20-2021, 09:56 AM
RE: ascii question - by Larz60+ - Aug-20-2021, 10:11 AM
RE: ascii question - by DPaul - Aug-20-2021, 04:07 PM
RE: ascii question - by Yoriz - Aug-20-2021, 04:19 PM
RE: ascii question - by DPaul - Aug-20-2021, 05:32 PM
RE: ascii question - by naughtyCat - Aug-21-2021, 01:47 PM
RE: ascii question - by perfringo - Aug-21-2021, 05:50 PM
RE: ascii question - by Yoriz - Aug-21-2021, 05:58 PM

Forum Jump:

User Panel Messages

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