Linked Questions
26 questions linked to/from How to check a string for specific characters?
-1
votes
3
answers
25k
views
How can I check if a string contains a special letter? [duplicate]
I am building a program that gets a password as a string and checks its strength by a couple of factors. I want to check if the entered string contains a special character (like %,,ドル# etc.) but so far ...
0
votes
2
answers
174
views
Python 3.x short version of code [duplicate]
Is there a way shorter way to check for characters in a string? Thanks :D
check = input("Put in the letter: ")
word = "word"
if(check == word[0]):
print(check)
if(check == word[1]):
print(...
-1
votes
2
answers
233
views
Parsing a string to find element [duplicate]
#!/usr/bin/python
def split(x):
return [char for char in x]
def func(x):
a = []
a.append(split(x))
for i in a:
if a[i]== "\"":
print ("hw")
str = "string\""
print (...
0
votes
3
answers
283
views
Python: How to check for specific characters inside a string from another string [duplicate]
I am coding a simple program in which I would like to have the user input a string and then my code will check from another string of characters (that are not allowed in the string).
The string of ...
1
vote
2
answers
132
views
How do I check if a character in an inputed sentence is a character in a given string? [duplicate]
I am a totally new programmer, learning python for the first time so sorry if my question isn't very clear and I am not using the correct computer science terminology. What I am trying to do is count ...
1
vote
2
answers
134
views
How to use multiple "or" in python code [duplicate]
My code below only prints "Remove Special Character". but if i leave only ("#"), it runs very well.
def name_character(word=input("Username: ")):
if ("#") or ("$") or ("&") in word:
...
0
votes
0
answers
30
views
How to check for a winner in Tic Tac Toe [duplicate]
I need to check if spaces on my board are empty. It will return True if there are no more available spaces.
Here is my code:
#
# File: done.py
# Purpose: Complete the code in the function "done&...
3585
votes
10
answers
7.5m
views
Does Python have a string 'contains' substring method?
I'm looking for a string.contains or string.indexof method in Python.
I want to do:
if not somestring.contains("blah"):
continue
8
votes
4
answers
137k
views
Python: print specific character from string
How do I print a specific character from a string in Python? I am still learning and now trying to make a hangman like program. The idea is that the user enters one character, and if it is in the word,...
4
votes
5
answers
3k
views
Split a string if character is present else don't split
I have a string like below in python
testing_abc
I want to split string based on _ and extract the 2 element
I have done like below
split_string = string.split('_')[1]
I am getting the correct ...
-1
votes
3
answers
17k
views
How to check a string for multiple letters in python
I am wondering how to check a string for certain letters to attach values to them so I can add them up, then return the total to the user.
How would I go with doing so?
-2
votes
3
answers
6k
views
How to check if some characters are in a string using Boolean?
If I want to know whether some characters are found in a string, how? String will be returned as Boolean. The body is as below :
Return True if the letters 'A', 'T', 'C' or 'G' are found in the ...
-1
votes
2
answers
2k
views
Creating an Algorithm to generate 20 digit codes
I am wanting to create an Algorithm that creates a 20 digit number code. Similar to how gift card codes are created. I would like to use python for it, since I know python the best out of ALL ...
1
vote
4
answers
943
views
How to compare user inputted string to a character(single letter) of a word in a list?
I'm trying to create a hangman game with python. I know there is still a lot to complete but I'm trying to figure out the main component of the game which is how to compare the user inputted string (...
0
votes
4
answers
234
views
What's wrong with the IF some words IN a string [duplicate]
How to check a string for specific characters?
I find the link is very useful. But what's wrong with my codes?
string = "A17_B_C_S.txt"
if ("M.txt" and "17") in string:
print True
else:
...