Python Forum
testing if a character in a string is an intended one
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
testing if a character in a string is an intended one
#2
did u mean bool(word[:1]) and word[:1] in 'wxyz'? else empty string is returned if word is an empty string.i'll say word[:1] in ('w','x','y','z') better in term of efficiency... less keyword/function used
. python 2.7
swallow osama bin laden
Reply


Messages In This Thread
RE: testing if a character in a string is an intended one - by ka06059 - Feb-26-2018, 08:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,414 Sep-27-2022, 01:38 PM
Last Post: buran
  Regex: a string does not starts and ends with the same character Melcu54 5 2,461 Jul-04-2021, 07:51 PM
Last Post: Melcu54
  [solved] unexpected character after line continuation character paul18fr 4 3,464 Jun-22-2021, 03:22 PM
Last Post: deanhystad
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,218 Jul-13-2020, 07:05 PM
Last Post: snippsat
  Remove from end of string up to and including some character lbtdne 2 2,368 May-17-2020, 09:24 AM
Last Post: menator01
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,784 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  How to get the index of a character from a string chihaya 1 2,186 Dec-03-2019, 12:54 PM
Last Post: buran
  Conditional not processing as intended (Colt Steeleā€™s Udemy course) Drone4four 3 2,032 Nov-07-2019, 04:47 PM
Last Post: Drone4four
  python gives wrong string length and wrong character thienson30 2 3,045 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  Find string and add character - newbi PyDK 1 2,090 May-15-2019, 01:22 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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