Delete hundreds of nodes by ID programmatically
You want to avoid deleting directly from the database. The node system distributes its data across a number of tables. Generally you always want to use the API. The method your after is node_delete() which takes the nid as its single argument. This will handle deleting all the associated data and firing off any hooks that are attached to the event.

An alternative approach:


Download and install the "Devel" module. This then gives you access to a page at /devel/php where you can run arbitrary PHP code within Drupal.
You could write custom code to load the text file and explode the nid's into an array. Something like this:

$nids = file_get_contents("/path/to/file"); 
$nids = explode(",", $nids); // This will depend on how your nids are delimited. Could be line break "\n"
foreach ($nids as $n) {
  node_delete($n);
}