473,670 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java Integer.ParseIn t 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.p arseInt(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 4628
"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.p arseInt(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.pytho n
To: <py*********@py thon.org>
Sent: Monday, January 31, 2005 7:27 PM
Subject: Re: Java Integer.ParseIn t 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
54174
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
2050
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 have posted my code so you can helpme with my search methods :D. DONT HELP ME WITH STEP 3 & 4 because I can already do those. JUST STEP 5 & 6 which is the serch methods is where I need help. Thanks a bunch.. only a real java genius should be able to...
18
2042
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 stuck and have been working on it all day. Here is the code i have, Please help if you can i have been working on this for way too long. public class Calendar { String tempStr; public int day; public int year; public...
6
2279
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 like to delete one record in database, it always shows "record not found" in my program, even if the data has been deleted. I tried to used function for each choices. But the compiler showed that we can't used function in static void. Is there...
7
5331
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 date System.out.println(string_dob); s.Info_DOB=Date.valueOf(string_dob); runs perfectly fine in the method insert() and throws up an illegal Exception in the method UPDATE.This is the error I get when I pass a date "1979-05-02"
1
11595
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. Here is the program that I am working with: // This application inputs and outputs account information. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*;
1
2448
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 TextField t1, t2, t3;
3
2572
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; String last;
5
3481
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 ) package admin; import java.lang.Object.*;
0
8471
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8907
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8593
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.