0

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"

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by moroccanplaya
1

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

Edited by woooee: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.