Importing vertices into Blender

The band perfume released files that contain skeleton animations that I used to create ribbons. I exported the vertices and faces I generated (based on the skeleton information), to simple text file which I then imported into blender. The script below is what I used to create a new object from these vertices and faces.

import bpy
from pprint import pprint
file = open("file_with_points.pts")
vertices = []
texcoords = []
faces = []
faces_raw = []
vertices_raw = []
part = 0
for line in file:
line = line.strip()
# Parsing Vertices or Faces
if line == "V":
part = 1
continue
elif line == "F":
part = 2
continue
if part == 1:
x,y,z,u,v = [float(bit.strip()) for bit in line.split(',')]
vertices_raw.append(x)
vertices_raw.append(y)
vertices_raw.append(z)
texcoords.append([u,v])
vertices.append([x,y,z])
elif part == 2:
a,b,c,d = [int(bit.strip()) for bit in line.split(',')]
#a,b,c = [int(bit.strip()) for bit in line.split(',')]
faces.append([a,b,c])
faces_raw.append(a)
faces_raw.append(b)
faces_raw.append(c)
faces_raw.append(d)
print("Vertices: ", len(vertices))
print("Vertices RAW: ", len(vertices_raw))
print("Faces: ", len(faces))
print("Faces RAW: ", len(faces_raw))
m = bpy.data.meshes.new("mesh_test")
# Number of vertices where one XYZ is one vertex
m.vertices.add(len(vertices_raw)/3)
m.vertices.foreach_set("co", vertices_raw)
# number of quads
m.tessfaces.add(len(faces_raw)/4)
# sets: m.tessfaces.vertices_raw[0] ..., [1]...
m.tessfaces.foreach_set("vertices_raw", faces_raw)
uv = m.tessface_uv_textures.new("uvtexture")
for face in m.tessfaces:
print(face.index)
texcoord_index = face.index * 2
print("texcoord start: ", texcoord_index, len(vertices))
uv.data[face.index].uv1 = texcoords[texcoord_index]
uv.data[face.index].uv2 = texcoords[texcoord_index+2]
uv.data[face.index].uv3 = texcoords[texcoord_index+1]
uv.data[face.index].uv4 = texcoords[texcoord_index+3]
#uv.data[face.index].uv1 = texcoords[face.index][0]
#uv.data[face.index].uv2 = texcoords[face.index][1]
#m.from_pydata(vertices, [], faces)
m.update()
ob = bpy.data.objects.new("mesh_obj", m)
ob.location = (0,0,0)
bpy.context.scene.objects.link(ob)

The file which I imported into blender had a very basic format. I started with all vertices, followed by the faces. This is a snippet from such a file.
V 65.6948, 88.589, -144.407,0, 0 38.6111, 75.6872, -144.528,0, 1 65.8619, 88.2368, -144.236,0.000581734, 0 38.6347, 75.6405, -144.365,0.000581734, 1 66.0792, 87.7644, -143.993,0.00116347, 0 F 0,2,3,1 2,4,5,3 4,6,7,5 6,8,9,7 8,10,11,9 10,12,13,11
