i have variable a with binary values then i have variable b with another set of binary values, i want variable b to into variable a and stored into variable c, i hope that not confusing


a = "01101000011001010111100100000000000000000000"


b = "011000100111100101100101"

c = "01100010011110010110010100000000000000000000"

Recommended Answers

All 2 Replies

Lists are the easiest and quickest way to work with data IMHO. You can then join the elements into one string http://www.diveintopython.net/native_data_types/joining_lists.html.

a = "01101000011001010111100100000000000000000000"


b = "011000100111100101100101"

combined_list=[]
combined_list.append(b)
combined_list.append(a[len(b):])  ## slice off length of "b"
print "".join(combined_list)

## result
01100010011110010110010100000000000000000000

thanks i appreciate your help :)

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.