Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
text1 = 2019
print(type(text1))
text2 = '2019'
print(type(text2))
text3 = 'Python String'
print(type(text3))
#!/usr/bin/python
text = " Let us learn strip in python "
# assign vales to list
list =["lets", "learn", "strip"]
# when strip() on the list method error
print(list.strip())
#!/usr/bin/python
# Assing a value to a string with extra characters
str = '@@@@Let us learn about strip function in Python!!!!!!!!!!';
# Prints the original value of the string
print str
# removes only the leading characters in the string
print("\nLeft Strip")
#!/usr/bin/python
# Assing a value to a string with unwanted characters
str = ' Ok Let us learn about strip function in Python Ok';
# Prints the original value of the string
print str
# Prints the striped value of the string after removing leading and trailing word 'Ok'
print str.strip(' Ok')
#!/usr/bin/python
# A custom function to check the count of the string
def countStr(text):
print("Length of the string before strip()")
print(len(text))
# Using strip() to remove white spaces
str = text.strip()
#!/usr/bin/python
# Assing a value to a string with extra characters
str = '@@@@Let us learn about strip function in Python!!!!!!!!!!';
# Prints the original value of the string
print str
# Prints the striped value of the string
print str.strip('@!')
@goyalrohit
goyalrohit / strip1.py
Last active September 21, 2019 08:20
#!/usr/bin/python
str = ' Let us learn about strip in Python! \n';
print str
print str.strip()
<html>
<style>
.cssmarquee {
height: 50px;
overflow: hidden;
position: relative;
}
.cssmarquee h1 {
position: absolute;
color: turquoise;
<style>
.cssmarquee {
height: 200px;
overflow: hidden;
position: relative;
}
.cssmarquee h1 {
position: absolute;
color: turquoise;
width: 100%;
<html>
<style>
.cssmarquee {
height: 50px;
overflow: hidden;
position: relative;
}
.cssmarquee h1 {
position: absolute;
width: 100%;