how can I convert data in ascii format to raster using python script?
Which ascii format is this then?
If it is something like *.asc with a well defined header as per this help :
Then the Ascii Grid tool will import this into a raster.
Neil is correct ... an updated link if you are using ArcMap 10.3 Ascii to raster
When you say a python script ... skip it ... if you plan on reinventing the wheel, the script example with the tool help will allow you to access the conversion, but it will not be a script that performs the actual conversion for you. For arcpy access, it is in the code examples as
arcpy.ASCIIToRaster_conversion(inASCII, outRaster, rasterType)