Converting integer to string (as in binary), and back 
	 
	
		| Author | 
		Message | 
	 
		 
		DtY
 
  
 
    
		 | 
		
		
			
				  Posted: Sun Aug 02, 2009 8:24 pm    Post subject: Converting integer to string (as in binary), and back  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Is there a standard python method to take a string and convert it to an integer, and back. I don't mean like 123456=>"123456", but 123456=>"\x00\x01\xE2\x40", and back with a specified width (in bytes) for the output.
 
 
Thanks
 
 
[edit] Fixed typo in title
 
[edit 2] Fixed typo in edit notice about fixing typo >_>
 
[edit 3] Just remembered, I'd prefer if the output was big endian, but as long as it's system independent, I can just reverse the string if it's not. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		btiffin
 
  
 
    
		 | 
		
		 | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |