I have this string s = 'ha\xcc\x81nh'. I want to use as byte, is there anything as b'{s}' like f string f'{s}'
            Asked
            
        
        
            Active
            
        
            Viewed 507 times
        
    1 Answers
2
            
            
        Normally we can use the following code to convert a string to a byte string.
b = sample_string.encode()
If we use this method in your use-case it would be like this.
b = f'{s}'.encode()
 
    
    
        Nuran
        
- 331
- 3
- 14
