I want to allow certain characters to a string
For example I want

strA to contain either 'A' or 'B' or 'C' or 'D'

How do I do that, help would be greatly appreciated.

Thanks

strA = 'A' or 'B' or 'C' or 'D'

I want to allow certain characters to a string
For example I want

strA to contain either 'A' or 'B' or 'C' or 'D'

How do I do that, help would be greatly appreciated.

Thanks

strA = 'A' or 'B' or 'C' or 'D'

Your questions are soooo vague. Could you please post what code you have? Giving us a example input/output never hurt either! I feel like I anwsered this question from you in the last 24 hours.

commented: Very nice guy. Takes time to help out +1

sorry

I mean like if I input either A, B, C, or D into python shell

I would get like True

if I enter R or some other letter or number or character
I would get False

Thanks

Can be as simple as this ...

strA = 'B'
print(strA in 'ABCD')

I figured it out using a dumb way stating all conditions with boolean operators lol
Your way is much nicer, thanks a bunch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.