473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Java Integer.ParseInt translation to python


Greetings!

I've looked through the internet (not long, though) but I have not been able
to find a python translation to

buffer[0] = (byte)Integer.parseInt(string,16);

Has anyone ported any java programs to python and has translated this?

any help would be greatly appreciated.

thanks.

josé

Jul 18 '05 #1
3 4616
"jose isaias cabrera" <ji****@cinops.xerox.com> writes:
I've looked through the internet (not long, though) but I have not
been able to find a python translation to

buffer[0] = (byte)Integer.parseInt(string,16);

Has anyone ported any java programs to python and has translated this?


I think the Python equivalent would be:

buffer[0] = chr(int(string, 16))

That is, you're trying to convert two hex digits into a single char, right?
Jul 18 '05 #2
buffer[0] = int(string,16) & 0xff

that should work

Jul 18 '05 #3

thanks everyone...!

----- Original Message -----
From: "ech0" <th******@gmail.com>
Newsgroups: comp.lang.python
To: <py*********@python.org>
Sent: Monday, January 31, 2005 7:27 PM
Subject: Re: Java Integer.ParseInt translation to python

buffer[0] = int(string,16) & 0xff

that should work

--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Henrik | last post by:
In Java you can write something like this. Does anyone know how to do this in javascript? "byte b=Integer.parseInt(int value or String).byteValue;"
3
by: yoyojava | last post by:
here go to this link: http://staff.beaumont.k12.tx.us/jchauvi/CS2/CS2.html ..... then click on PROJECT:Bruin Grocery ... and i am done with everything except for step 5 and 6 the search methods.. i...
18
by: Minor | last post by:
I am in a beginner java class and am having trouble getting a program to work. We are asked to create a calendar type application to display a calendar. It uses a application and a worker class I am...
6
crystal2005
by: crystal2005 | last post by:
Hello guys, I'm a beginner in Java application programming. I started to write a Java application in which link to MS Access database. I encountered a problem in deletion function. E.g. I would...
7
helpwithcode
by: helpwithcode | last post by:
Hi people, I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements, String string_dob=text_dob.getText(); //Converting string to...
1
by: rainman33 | last post by:
I am getting this error message in the program I'm working on (line 150), and am wondering what it means? This is an exercise for a college class; just want to declare that; this is not my own work....
1
by: ketand1 | last post by:
import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.sql.*; import java.lang.*; class DbAwt extends Frame implements ActionListener { private...
3
by: gator6688 | last post by:
import java.text.DecimalFormat; import javax.swing.JOptionPane; public class PayrollSystemTest { public static void main( String args ) { String workerType; String first;...
5
by: creative1 | last post by:
hi, I am new at writing JSP and Servlets. When I compile my serverlet I get follwoing error cannot find mymbol method parseDate(java.lang.String) I have follwoing code: Code: ( text )...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.