Answers for "string python"

16

how to create string in python

string = "this is string"
#or
string = 'this is also string'
Posted by: Guest on April-15-2020
1

modulo str python

#look like: your_srting % values
  #when:
  #your_string = "any king of character %format"
  #type(value) = tuple
# A falg can be added between the % and the format

#Exemple:

print("there is %d ducks in the lake" % 34) #>>> there is 34 duck in the lake

# Or

your_string = "%d of the %d ducks are ducklings"
values = (12, 32)
print(your_string % values) #>>> 12 of the 34 ducks are ducklings

Formaters are:
  # Strings
  %s to display as string (and do str(value) if needed)
  #Integers
  %i to display in default int form
  %d to display as a decimal integer
  %x to display as an hexadecimal intedger (with lettre in lowercase)
  %X to display as an hexadecimal intedger (with lettre in uppercase)
  %o to display as an octal integer
  %u to display as an unsigned integer
  %c to display in ascii (process "chr(value)")
  #Floats
  %f to display in default float form
  %e to display in scientific writing (with a lowercase e to expess exponent)
  %E to display in scientific writing (with an uppercase E to expess exponent)
  %g to display as an floating exponent
Posted by: Guest on June-17-2020
3

how to create a string in python

var1 = "A String"
Posted by: Guest on March-08-2020
2

define a string in python

string1 = "something"
string2 = 'something else'
string3 = """
something
super
long
"""
Posted by: Guest on December-04-2020
0

print string python

Name = "Jack"
print(" Good morning! Mr.",Name)
Posted by: Guest on January-21-2021
0

python string

#string of all ascii caracters
string = '!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
Posted by: Guest on July-16-2021

Python Answers by Framework

Browse Popular Code Answers by Language