Tags » Strings

Peabody Alumni Perform At Celebration

Peabody musicians performed at Taiwan’s 107th National Day celebration in Twin Oaks, Washington, D.C. This event is the most important national event of the year for Taiwan in U.S. 45 more words

News

Leave your wedding music entertainment to a professional band

Weddings are supposed to be the biggest and the most special day of an individual’s life. So, naturally, when planning your wedding, there are going to be a myriad of personal and important decisions to be made. 197 more words

Jazz

log(improvements)

One of the features I had been meaning to get around to for some time was improvements to the logging. The original system had one enum value per error. 410 more words

Interpreted Programming Language

just watch this i promise

I think I might keel over from  how beautiful this is.

I’ve been obsessed with him for so long – this is like, transcendent to me.

String manipulation

here are some basic string manipulation tasks in python

#string basics

name = "dave bloke"

#access a whole string
print("#access a whole string")

print(name)


#concatenation - joining strings
a = "hello"
b = "world"

#put two strings together
c = a + b
#put two strings together with a space
d = a + " " + b


#access the first (left most) 3 characters
print("#access the first 3 characters")

print(name)


#access the last (right most) 3 characters
print("access the last (right most) 3 characters")

print(name[-3:])


#access the first character in a string
#which starts at position 0
print("#access the first character in a string")

print(name[0])


#use a for loop to access each character of a string
#one at a time
print("#use a for loop to access each character of a string")

for x in range(0,len(name)):
    print(name[x])


#use a while loop and a variable
#to access each character in the string
print("#use a while loop and a variable")
      
x = 0
while x < len(name):
    print(name[x])
    x += 1


#use split to separate a string using a delimeter
print("#use split to separate a string using a delimeter")
      
name = "dave bloke"
parts = name.split(" ")
#then use a loop to process each item
for item in parts:
    print(item)


#use different delimeters with split for different formats
#of your data
print("#use different delimeters with split for different formats")
      
numbers = "101,221,334,454,534,822,922"
values = numbers.split(",")
#then use a loop to process each item
total = 0
for item in values:
    total += int(item)

print("total is",total)

#replacing text within a string
line = "Hello\nWorld")
print(line)

#use replace to swap text
line.replace("Hello","Goodbye"))
print(line)

#remove line breaks with no characters
line.replace("\n",""))
print(line)

 

Python Programming

L'abri Trio Named Finalist and Releases CD

Doctoral candidates Bonghee Lee, piano, Kenny Baik, saxophone, and Mauricio Rey Gallego, cello, make up the L’abri Trio, which was selected to be a finalist at the… 35 more words

News